package net.dgg.zz.common.utils;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * 常用正则
* <p>Title: RegularUtil</p>  
* <p>Description: </p>  
* @author xy
* @date 2018年9月20日
 */
public class RegularUtil {
	
	public static final String REG_PHONE = "^[1][3,4,5,7,8][0-9]{9}$";//手机
	
	public static final String REG_FIXD_PHONE = "^[1-9]{1}[0-9]{5,8}$";//固话-不带区号
	
	public static final String REG_FIXD_PHONE_PREFIX = "^[0][1-9]{2,3}-[0-9]{5,10}$";//固话-带区号
	
	/**
	 * 验证正则是否匹配
	 * @param content
	 * @param regRule
	 * @return
	 */
	public static boolean verifyMatch(String content,String regRule) {
		String pattern = regRule;  
        Pattern p = Pattern.compile(pattern);  
        Matcher m = p.matcher(content);  
        return m.matches();
	}
	/*public static void main(String[] args) {
		System.err.println(verifyMatch("18408252135",REG_PHONE));
	}*/
}
